<template>
  <!-- 容差设置 -->
  <div class="tolerance">
    <el-form ref="form" :model="form" :rules="rules">
      <el-row>
        <el-col :span="12">
          <el-form-item label="负容差（mm）" prop="workArea" label-width="140px">
            <el-input type="number" min="0" v-model="form.workArea" placeholder="请输入负容差" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="正容差（mm）" prop="name" label-width="140px">
            <el-input type="number" min="0" v-model="form.name" placeholder="请输入正容差" />
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item prop="gender">
            <el-input type="textarea" :rows="6" v-model="form.gender" placeholder="每行一个模数" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="submitForm">
      <el-button type="primary" @click="submitForm">保存</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: "Tolerance",
  components: {},
  props: {},
  data() {
    return {
      form: {},
      rules: {
        workArea: [
          { required: true, message: "负容差不能为空", trigger: "blur" },
        ],
        name: [
          { required: true, message: "正容差不能为空", trigger: "blur" },
        ],
        gender: [
          { required: true, message: "每行一个模数不能为空", trigger: "blur" },
        ]
      },
    };
  },
  filters: {},
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  beforeDestroy() {},
  methods: {
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          console.log(this.form)
        }
      })
    },
  },
};
</script>

<style scoped lang="scss">
.tolerance {
  width: 50%;
}
</style>
